<?php
require "DataLoad.php"; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<title><?php echo $GuildName;?> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="DKP WOW GUILD">
<meta name="Description" content="">
<link href="<?php echo $StylePath;?>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<?php echo $StylePath;?>/styleplus.js"></script>
<script language="JavaScript" src="inc/UBB_UI.js"></script>
<style type="text/css" media="all">

</style>
<?php require "inc/ajax.php"; ?>
</head>

<body>
<div class="header">
<?php require "menu.php"; ?>
</div>
<div class="main">
<?php 

if (!is_numeric($_GET['id']) || $_GET['id']=="") {
	RaidList();
}else{
	if ($_GET['sub']=="delEvents") {
		//DelEvents($_POST["idlist"]);
	}
	$R = new Raid();
	$R->RaidLoad($_GET['id']);

/*
	ReportCore();
	ShowReport();
	Update_lastraid($ArrRaidPlayer,$RaidActionTime);
	DataUpdate();
	GuestBook();
*/
	echo $R->viewRaidInfo();
	echo $R->viewItems();
	echo $R->viewEvents();
	echo $R->viewMembers();

	$R->debugg();
}

?>
</div>
<?php require "footer.php"; ?>

</body>
</html>
<?php 





function RaidList() {
	print "			<table class=' outframe'>";
	print "<tr><th colspan='7'><div class='title'><img src='images/icon/axe.jpg'>活动列表</div><div class='filter'>".selectraid2()."</div></th></tr>";
	print "			<tr class='coltitle'>";
	print "				<td widtd='35px'></td>";
	print "				<td>分类</td>";
	print "				<td>活动</td>";
	print "				<td>时间</td>";
	print "				<td>历时</td>";
	print "				<td>指挥</td>";
	print "				<td width='40%'>备注</td>";
	print "			</tr>";

	if ($_POST["filter"]!="") {

		switch (true) {
			case $_POST["filter"]="all":
				$sql="select * from raid Order by raid_actiontime desc";
				break;
			case $_POST["filter"]="edit":
				$sql="select * from raid where raid_step<1 Order by raid_actiontime desc";
				break;
			case $_POST["filter"]="end":
				$sql="select * from raid where raid_step>1 Order by raid_actiontime desc";
				break;
			case       $left[$_POST["filter"]][1]="D":
				$sql="select * from raid where raid_class=".substr($_POST["filter"],1)." Order by raid_actiontime desc";
				break;
			case       $left[$_POST["filter"]][1]="R":
				$sql="select * from raid where raid_ruler='".substr($_POST["filter"],1)."' Order by raid_actiontime desc";
				break;
		}
	}
		else
	{

		$sql="select * from raid where raid_step>0 Order by raid_actiontime desc";
	} 


	if (!$result = mysql_query($sql)) {
		print "<tr><td colspan='7' >没有找到链接项</td></tr>";
	}else{
		if ($_GET["page"]>0) {
			$result->move(${"page"}-1)*20;
		} 
		while ($row = mysql_fetch_array($result)) {
			print "<tr class='".linec($i)."'>";
			print "<td>".getInstanceIco($row["raid_name"])."</td>";
			print "<td>".getRaidClassText($row["raid_class"])."</td>";
			print "<td>".LogicM($row["raid_step"],"1,2,3",",,已归档",",")."<a href='?id=".$row["id"]."'>".$row["raid_name"]."</a></td>";
			print "<td>".$row["raid_actiontime"]."</td>";
			print "<td><b>".formattime($DateDiff["n"][$row["raid_actiontime"]][$row["raid_endtime"]])."</b></td>";
			print "<td>".$row["raid_commander"]."</td>";
			print "<td>".$row["raid_plan"]."</td>";
			print "</tr>";
		}
	}

	print "</table>";
	print pages($result,20,"","10");
	return $function_ret;
} 


function Update_lastraid($arrPid,$sdate) {

//更新成员最后一次参加的日期
	$pid=$join[$arrPid]["|"];
	$sql="select * from player";
	$result = mysql_query($sql);
	if ($result->bof || $result->eof) {

	}
		else
	{

		for ($i=1; $i<=$result->recordcount; $i=$i+1) {
//Response.write pid
//Response.write rs("player_name")&Datediff("d",rs("player_lastraid"),sdate)&","
			if ($result["player_lastraid"]=="" || !isset($result["player_lastraid"])) {

				if ((strpos("|".$pid,"|".$result["id"]."|") ? strpos("|".$pid,"|".$result["id"]."|")+1 : 0)>0) {

				  $conn->execute("update player set player_lastraid=#".$sdate."# where id=".$result["id"]);
				} 

			}
				else
			{

				if ((strpos("|".$pid,"|".$result["id"]."|") ? strpos("|".$pid,"|".$result["id"]."|")+1 : 0)>0 && ($Datediff["d"][$result["player_lastraid"]][$sdate]>0)) {

				  $conn->execute("update player set player_lastraid=#".$sdate."# where id=".$result["id"]);
				} 

			} 

			$result->movenext;

		}

	} 

	$result->close;
	return $function_ret;
} 


function selectraid() {

	$sql="select top 20 * from raid order by id desc";
	$result = mysql_query($sql);
	$stext=$stext."<select name='id' onChange='javascript:submit();''>";
	$stext=$stext."<option value=''>选择Raid</option>";
	if (!($result->eof || $result->bof)) {

		for ($i=1; $i<=$result->recordcount; $i=$i+1) {
			$stext=$stext."<option value='".$result["id"]."'>".time_type($result["raid_actiontime"],3)." - ".$result["raid_name"]."</option>";
			$result->movenext;

		}

	} 

	$stext=$stext."<option value='More'>More...</option>";
	$stext=$stext."</select>";
	$function_ret=$stext;
	$result->close;
	return $function_ret;
} 






//返回"加入"或"离开"的逻辑图片名称
function GAorGB($F,$N) {
	if (intval($N/2)==$N/2) {
		if ($F=="J") {
			return "gb.gif";
		}else{
			return "ga.gif";
		} 
	}else{
		if ($F=="L") {
			return "gb.gif";
		}else{
			return "ga.gif";
		} 
	} 
} 



?>
